<?php

$path = 'D:/www/smit/';
$excluded = array('dev', 'components', 'geshi', 'decoda', 'styles', 'assets', 'admincp', 'templates', 'simplered');
$i = 0;
$files = array();

function explore($dir = '', $level = 0)
{
	global $excluded, $i, $files;

	$iterator = new DirectoryIterator($dir);
	foreach ($iterator as $fileinfo) {
		$ext = strtolower(strrchr($fileinfo->getFilename(), '.'));
		if (!$fileinfo->isDot() && !in_array(strtolower($fileinfo->getFilename()), $excluded) && ($ext == '.php' || $ext == '') && !stristr($fileinfo->getFilename(), 'sbk.')) {
			//echo $iterator->getPath() . '/' . $fileinfo->getFilename() . chr(10);
			switch($iterator->getType())
			{
				case 'file':
					$i++;
					$prefix = str_repeat("  ", $level);

					$files[] = $prefix . $iterator->getPath() . '/' . $fileinfo->getFilename();
				break;
				case 'dir':
					explore($iterator->getPath() . '/' . $fileinfo->getFilename() . '/', ($level + 1));
				break;
			}
		}
	}
}

explore($path);

file_put_contents('out.txt', 
'
-------------------------------------------------------
	Explored '.$i.' Files, Structuring output...
	
	The Files are listed for Clarification
-------------------------------------------------------

	'.implode("\n", $files).'

');

echo 'Explored '.$i.' Files, Dumped to out.txt';
?>